async function check(prompt = true,redirect = false)
{
    let business = cookie.get('business') ? JSON.parse(cookie.get('business')) : {};
    
    if(!business || Object.getOwnPropertyNames(business).length === 0)
    {
        if(prompt === true)
        {
            mui.toast('请先登录',{duration:1500});
        }

        if(redirect === true)
        {
            setTimeout(() => {
                location.href = 'login.html';
            },1500);
        }

        return false;
    }

    let id = business.hasOwnProperty('id') ? business.id : 0;
    let mobile = business.hasOwnProperty('mobile') ? business.mobile : '';

    let result = await POST({
        url:'business/check',
        params:{
            id,
            mobile
        }
    });

    if(result.code === 1)
    {
        return result;
    }else{
        if(prompt === true)
        {
            mui.toast(result.msg,{duration:1500});
        }

        if(redirect === true)
        {
            setTimeout(() => {
                location.href = 'login.html';
            },1500);
        }

        // 清空cookie
        cookie.remove('business');

        return false;
    }

}


//从URL中提取查询参数       
function getParam(name)
{
    let query = decodeURI(location.search.slice(1));

    if(query)
    {
        let vars = query.split('&');

        if(vars.length > 0)
        {
            for(let val of vars)
            {
                let pair = val.split('=');

                if(pair[0] == name)
                {
                    return pair[1];
                }
            }
        }
    }

    return null;
}